package com.zzh.weixinsell.dao;

import com.zzh.weixinsell.model.pojo.ProductCategory;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
@Mapper
public interface ProductCategoryMapper {
    int deleteByPrimaryKey(Integer categoryId);

    List<ProductCategory> findByCategoryType(@Param("category_type") List<Integer> categoryTypeList);

    @Select("select * FROM product_category where category_id = #{category_id}")
    ProductCategory findOne(@Param("category_id") Integer category_id);

    @Insert("INSERT INTO `wechat_order_system`.`product_category` (`category_id`, `category_name`, `category_type`) VALUES (#{category_id}, #{category_name}, #{category_type})")
    int insertOne(@Param("category_id")Integer category_id,@Param("category_name")String category_name,@Param("category_type")Integer category_type);

    @Select("select * from product_category")
    List<ProductCategory> findAll();

    @Update("UPDATE `wechat_order_system`.`product_category` SET `category_name`= #{category_name}, `category_type`=#{category_type} WHERE `category_id`=#{category_id};")
    int updateById(@Param("category_name") String category_name, @Param("category_type") Integer category_type, @Param("category_id") Integer category_id);




}